
import com.context.conexion.EnahoConexion;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Rdelacruz
 */
public class TestEnahoConexion {
    
    
    
    public static void main(String args[]) {
         
        Connection con = null;
        Statement st = null;
        try {
            con = EnahoConexion.getConexion();
            st = con.createStatement(); 
            ResultSet rs = st.executeQuery("select * from CampoEna01_Cap_100");
            ResultSetMetaData rsmd = rs.getMetaData();
            System.out.println("n="+rsmd.getColumnCount());
            
            mostrar(rsmd,1);
            mostrar(rsmd,2);
            mostrar(rsmd,3);
            mostrar(rsmd,4);
            mostrar(rsmd,5);
            mostrar(rsmd,6);
            mostrar(rsmd,7);
            mostrar(rsmd,8);
            mostrar(rsmd,9);
            mostrar(rsmd,10);
            mostrar(rsmd,11);
            mostrar(rsmd,12);
            mostrar(rsmd,13);
            mostrar(rsmd,14);
            mostrar(rsmd,15);
            mostrar(rsmd,16);
            
            
            mostrar(rsmd,81);
        } catch (Exception ex) {
            Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
        }
        finally {
            try {
                if(con!=null) con.close();
                if(st!=null) st.close();
            } catch (SQLException ex) {
                Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
            }
        }        
    }
    
    public static void mostrar(ResultSetMetaData rsmd, int c) throws SQLException {
        System.out.println(rsmd.getColumnName(c)+" "+rsmd.getColumnTypeName(c));
    }
}
